window.uploader = {
	/*
	 * 获取图片上传路径，
	 * 	若执行成功，则执行回调函数进行图片上传
	 * 	若执行失败，则打印log，不进行上传
	 */
	upload: function (filename, callback) {
		var serverUrl = app.serverAddress
					  + "/u/upload_file_path?filename="
					  + filename;
					  
		fetch(serverUrl)
			.then(response => {
				response.json().then(resJson => callback(resJson.msg))
			}).catch(err => {
				console.error(err);
			});
	},
	
	put: function (url, data, succeed, failed) {
		fetch(url, {
			method: 'PUT',
			body: data
		}).then(() => {
			console.log('succeed!');
		}).catch(e => {
			console.error('error: ' + e);
		});
	},
};